﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the Microsoft Public License (Ms-PL).
// See accompanying file License.txt or copy at http://mews.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Mews.Application
{
    using System;
    using System.Windows.Forms;

    /// <summary>The base class of all forms that have a title.</summary>
    /// <remarks>This class must be public and non-abstract so that deriving forms can be designed.</remarks>
    public partial class TitleForm : Form
    {
        /// <summary>Initializes a new instance of the <see cref="TitleForm"/> class.</summary>
        /// <remarks>This constructor must remain public so that deriving forms can be designed.</remarks>
        public TitleForm()
        {
            this.InitializeComponent();
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>Initializes a new instance of the <see cref="TitleForm"/> class.</summary>
        public TitleForm(Form owner, string title, bool showMinimizeBox) : this()
        {
            if (owner != null)
            {
                this.Owner = owner;
            }

            if (string.IsNullOrEmpty(title))
            {
                this.titleLabel.Visible = false;
                this.separatorPictureBox.Visible = false;
            }
            else
            {
                this.titleLabel.Text = title;
            }

            this.MinimizeBox = showMinimizeBox;
        }
    }
}